<?PHP

/***************************************************************************
*    This file is part of OSMW.                                            *
*                                                                          *
*    OSMW is free software: you can redistribute it and/or modify          *
*    it under the terms of the GNU General Public License as published by  *
*    the Free Software Foundation, either version 3 of the License, or     *
*    (at your option) any later version.                                   *
*                                                                          *
*    OSMW is distributed in the hope that it will be useful,               *
*    but WITHOUT ANY WARRANTY; without even the implied warranty of        *
*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
*    GNU General Public License for more details.                          *
*                                                                          *
*    You should have received a copy of the GNU General Public License     *
*    along with OSMW.  If not, see <http://www.gnu.org/licenses/>.       *
****************************************************************************/

class main {

	function StartConnection($host, $user, $pass) {
		$MySQL_Main = mysql_connect($host, $user, $pass);
		if(!$MySQL_Main) { 
			die("<b>ERROR 100: MySQL Connection Failed!</b>");
		}
	}
	
		function UseDatabase($db) {
			$UseDB = mysql_select_db($db);
			if(!$UseDB) { 
			die("<b>ERROR 101: MySQL Database - Does not exist!</b>"); 
		}
	}
		function CheckVersion($version, $rversion) {
			if($version != $rversion) {
				die('Your version of the website is '.$version.', the system requires v1.0');
		}
	}
	
		function LoadStyle($style) {
			if(file_exists('templates/'.$style.'/header.php')) {
				require_once('templates/'.$style.'/header.php');
				require_once('templates/'.$style.'/body.php');
				require_once('templates/'.$style.'/footer.php');
			} else {
				die("<b>ERROR 102: Template '".$style."' does not exist! Check config!");
			}
		}
	
	function AbortConnection($name) {
		$close = mysql_close($MySQL_Main);
	}
	


	
}

?>